import { Routes, Route, Navigate } from 'react-router-dom'
import { lazy, Suspense } from 'react';
const Login = lazy(() => import('./pages/login'))
const Index = lazy(() => import('./pages/index'))
function App() {
  return (
    <div className="App">
      <Suspense fallback={<h2>正在加载中！请稍等~</h2>}>
        <Routes>
          {/* 一级路由 */}
          <Route path='/login' element={<Login />}></Route>
          <Route path='/index/*' element={<Index />}></Route>
          {/* 一级路由重定向 */}
          <Route path='*' element={<Navigate to='/login'></Navigate>}></Route>
        </Routes>
      </Suspense>
    </div>
  );
}

export default App;